package com.wuzhun.wxmp.util;

import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.VerticalAlignment;

/**
 * Excel工具栏
 *
 * @author Paulin
 * @date 2023/6/6 12:37
 */
public class ExcelUtil {
    /**
     * 单元格边框
     * @return {@link HorizontalCellStyleStrategy}
     * @date 2021/10/26 13:22
     * @author <a href="">fxsen</a> <br/>
     * @version 1.0.0 <br/>
     **/
    public static HorizontalCellStyleStrategy cellBorder(){
        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
        WriteFont writeFont = new WriteFont();
        writeFont.setFontName("宋体");
        contentWriteCellStyle.setWriteFont(writeFont);
        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);

        return new HorizontalCellStyleStrategy(contentWriteCellStyle, contentWriteCellStyle);
    }

}
